package com.lyj.ui.listener;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.lyj.pojo.User;
import com.lyj.service.UserService;
import com.lyj.service.impl.UserServiceImpl;

/**
* 
* @author 李艺江
* @version 创建时间：2018年12月20日 下午4:51:32
*/

public class OffLineListener implements HttpSessionListener{

	@Override
	public void sessionCreated(HttpSessionEvent arg0) {

	}

	@Override
	public void sessionDestroyed(HttpSessionEvent event) {
		HttpSession session = event.getSession();
		User user = (User)session.getAttribute(User.SESSION_NAME);
        //修改下线状态
		UserService userService = new UserServiceImpl();
		userService.online(user,false);
	}
}
